package ${pkg}.bean;

import java.util.HashMap;
import java.util.Map;
import com.kool.core.base.BaseBean;

/**
 * @AUTHOR LUYU
 */
public class ${upTumTabNam}Bean extends BaseBean {
	<#list columns as col>
	protected ${col.javaType} ${col.lowJavaName};
	<#if col.javaType == "java.sql.Timestamp" || col.javaType == "java.sql.Date">
	protected ${col.javaType} ${col.lowJavaName}Max;
	protected ${col.javaType} ${col.lowJavaName}Min;
	</#if>
	protected boolean isInit${col.upJavaName};
	</#list>

	<#list columns as col>
	public boolean getIsInit${col.upJavaName}() {
		return this.isInit${col.upJavaName};
	}

	</#list>	
	<#list columns as col>
	public ${col.javaType} get${col.upJavaName}() {
		return ${col.lowJavaName};
	}

	public void set${col.upJavaName}(${col.javaType} ${col.lowJavaName}) {
		this.${col.lowJavaName} = ${col.lowJavaName};
		this.isInit${col.upJavaName} = true;
	}
	<#if col.javaType == "java.sql.Timestamp" || col.javaType == "java.sql.Date">
	public ${col.javaType} get${col.upJavaName}Max() {
		return ${col.lowJavaName}Max;
	}

	public void set${col.upJavaName}Max(${col.javaType} ${col.lowJavaName}Max) {
		this.${col.lowJavaName}Max = ${col.lowJavaName}Max;
	}
	
	public ${col.javaType} get${col.upJavaName}Min() {
		return ${col.lowJavaName}Min;
	}

	public void set${col.upJavaName}Min(${col.javaType} ${col.lowJavaName}Min) {
		this.${col.lowJavaName}Min = ${col.lowJavaName}Min;
	}
	</#if>
	
	</#list>
	public Map<String, String> toMap() {
		Map<String, String> map = new HashMap<String, String>();
		<#list columns as col>
		if (isInit${col.upJavaName}) {
			map.put("${col.lowJavaName}", formatString(${col.lowJavaName}));
		}
		</#list>

		return map;
	}

	public static ${upTumTabNam}Bean DBResultToBean(Map<String, Object> map) {
		if (null == map) {
			return null;
		}
		${upTumTabNam}Bean reqDef = new ${upTumTabNam}Bean();
		<#list columns as col>
		reqDef.set${col.upJavaName}((${col.javaType}) map.get("${col.columnName}"));
		</#list>
		return reqDef;
	}
}